package com.lagou.service.impl;

import com.lagou.service.EmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

/**
 * @AUTHOR: yb.feng
 * @DATE: 2020/7/1 22:34
 * @DESC:
 */
@Service
public class EmailServiceImpl implements EmailService {

    @Autowired
    private JavaMailSender javaMailSender;

    @Override
    public void sendEmail(String email, String code) {
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom("610477554@qq.com");
        message.setTo(email);
        message.setSubject("验证码");
        message.setText(code);
        javaMailSender.send(message);
    }
}
